#ifndef GAMEENGINE_MAPS_SQUARE_MAP_RENDERER_H
#define GAMEENGINE_MAPS_SQUARE_MAP_RENDERER_H

#include <GameEngine/Maps/maps_settings.h>

#include <GameEngine/Graphics/display_list.h>
#include <GameEngine/Graphics/Texture/texture2d.h>
#include <GameEngine/Graphics/Scene/scene_element.h>
#include <GameEngine/Maps/square_map.h>

#include <list>



#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

#ifndef DOXYGEN_IGNORE

//=================================================================================


//! A map made of square cells
/*!
 *  The map contains an array of map cells and a set of terrain descriptions. This
 *  allows to find the shortest path in the map, using the SquareMapSearch class.
 */
class SquareMapRenderer : public SceneElement {

public:
	SquareMapRenderer();
	virtual ~SquareMapRenderer();

	void build(const SquareMap& map, std::list<SquareMapSearch::Node>* path = nil);

	virtual bool draw(const Line3d<float>& ray);

protected:
	//! The map being rendered
	const SquareMap* map_;

	//! Display list used to draw the map
	DisplayList list_;

	//! Texture used to render the walls
	Texture2d wall_texture_;

	//! Texture used to render the ground
	Texture2d ground_texture_;

	//! Texture used to render the ground
	Texture2d sea_texture_;

	//! Texture used to render the ground
	Texture2d sand_texture_;

	//! Texture used to render the ground
	Texture2d swamp_texture_;
};

#endif

//========================================================

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
